package com.anbang.website.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class Constant {
	public static final Properties webconfig = new Properties();

	public static final String CHARSET = "utf-8";

	private static String host = "";
	public static String getHost() {
		if("".equals(host)){
			host = webconfig.getProperty("service.host");
		}
		return host;
	}

	private static String serverUrl = "";
	public static String getServerUrl() {
		if("".equals(serverUrl)){
			serverUrl = getHost().concat(webconfig.getProperty("app.name"));
		}
		return serverUrl;
	}

	private static String serviceUrl = "";
	public static String getServiceUrl() {
		if("".equals(serviceUrl)){
			serviceUrl = getServerUrl().concat(webconfig.getProperty("api.url"));
		}
		return serviceUrl;
	}

	private static String signHostUrl = "";
	public static String getSignHostUrl() {
		if("".equals(signHostUrl)){
			signHostUrl = webconfig.getProperty("sign.host").concat(webconfig.getProperty("app.name"))
					.concat(webconfig.getProperty("api.url"));
		}
		return signHostUrl;
	}

	private static String appKey = "";
	public static String getAppKey(){
		if("".equals(appKey)){
			appKey = webconfig.getProperty("appkey");
		}
		return appKey;
	}
	
	private static String appSecret = "";
	public static String getAppSecret(){
		if("".equals(appSecret)){
			appSecret = webconfig.getProperty("appsecret");
		}
		return appSecret;
	}

	public static final String IS_PRESCRIPTION_YES = "1";
	public static final String IS_PRESCRIPTION_NO = "0";

	public static final Map<String, String> prescriptionEnum() {
		Map<String, String> prescriptionEnum = new HashMap<String, String>();
		prescriptionEnum.put(IS_PRESCRIPTION_YES, "处方");
		prescriptionEnum.put(IS_PRESCRIPTION_NO, "非处方");
		return prescriptionEnum;
	}

	// 是否含麻黄碱1 包含、0 不包含IS_EPHEDRINE

	public static final String IS_EPHEDRINE_YES = "1";
	public static final String IS_EPHEDRINE_NO = "0";

	public static final Map<String, String> ephedrineEnum() {
		Map<String, String> ephedrineEnum = new HashMap<String, String>();
		ephedrineEnum.put(IS_EPHEDRINE_YES, "含麻黄碱");
		ephedrineEnum.put(IS_EPHEDRINE_NO, "不含麻黄碱");
		return ephedrineEnum;
	}

	// 是否是冷藏品1 冷藏、0 不冷藏 IS_COLD_STORAGE
	public static final String IS_COLD_STORAGE_YES = "1";
	public static final String IS_COLD_STORAGE_NO = "0";

	public static final Map<String, String> coldStorageEnum() {
		Map<String, String> coldStorageEnum = new HashMap<String, String>();
		coldStorageEnum.put(IS_COLD_STORAGE_YES, "冷藏");
		coldStorageEnum.put(IS_COLD_STORAGE_NO, "不冷藏");
		return coldStorageEnum;
	}

	// 默认登录页URL
	public static final String DAFAULT_LOGIN_URL = "/login";
	// 订单来源 ：网站 0 手机 1
	public static final String ORDER_FROM_WHERE_WEBSITE = "0";
	// 订单下单者标志： 2 客户下单 1 业务联系人
	public static final String ORDER_OWN_CUSTOMER = "2";

	/**
	 * 订单审核标志
	 * 
	 * 0 完成、流程结束
	 * 2 联系人审核 
	 * 4开票员审核 
	 * 6 发送erp 
	 * 7 撤销
	 * 8 退货
	 * 9 退货确认 （暂时未用）
	 * B 审核退回到发起人
	 * N 空 ，无流程
	 * 
	 * 流程进行了简化： 客户--》业务联系人--》开票员--》提交ERP 退回到发起人
	 */
	public static final String ORDER_APPROVE_OVER = "0";
	public static final String ORDER_APPROVE_BUSINESSPERSON = "2";
	public static final String ORDER_APPROVE_BILLINGPERSON = "4";
	public static final String ORDER_APPROVE_COMMIT_ERP = "6";
	public static final String ORDER_APPROVE_REVOKE = "7";
	public static final String ORDER_APPROVE_RETURN = "8";
	public static final String ORDER_APPROVE_RETURN_CONFIRM = "9";
	public static final String ORDER_APPROVE_BACK = "B";
	public static final String ORDER_APPROVE_NULL = "N";

	public static final Map<String, String> approveEnum() {
		Map<String, String> approveEnum = new HashMap<String, String>();

		approveEnum.put(ORDER_APPROVE_OVER, "完成");
		approveEnum.put(ORDER_APPROVE_BUSINESSPERSON, "联系人审核");
		approveEnum.put(ORDER_APPROVE_BILLINGPERSON, "开票员审核");
		approveEnum.put(ORDER_APPROVE_COMMIT_ERP, "发送ERP");
		approveEnum.put(ORDER_APPROVE_REVOKE, "撤销");
		approveEnum.put(ORDER_APPROVE_RETURN, "退货");
		approveEnum.put(ORDER_APPROVE_RETURN_CONFIRM, "退货确认");
		approveEnum.put(ORDER_APPROVE_BACK, "审核退回");
		approveEnum.put(ORDER_APPROVE_NULL, "未审批");

		return approveEnum;
	}
}
